<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <title>31jQuery移入移出事件</title>
        <style>
            *{
                margin: 0;
                padding: 0;
            }
            .father{
                width: 200px;
                height: 200px;
                background: red;
            }
            .son{
                width: 100px;
                height: 100px;
                background: blue;
            }
        </style>
        <script src="http://code.jquery.com/jquery-1.12.4.js" 
        integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU="
        crossorigin="anonymous"></script>
        <script>
            $(function (param) {  
                
                //mouseover/mouseout：子元素移入移出也会触发父元素的事件
                $(".father").mouseover(function (param) { 
                    console.log("father被移入了");
                 });
                $(".father").mouseout(function (param) { 
                    console.log("father被移出了");
                 });
                 

               
                 //mouseenter/mouseleave：子元素移入移出不会触发父元素的事件（推荐使用）
                 $(".father").mouseenter(function (param) { 
                    console.log("father被移入了");
                 });
                $(".father").mouseleave(function (param) { 
                    console.log("father被移出了");
                 });
            

                $(".father").hover(function () {
                    console.log("father被移入了");
                  },function () {  
                      console.log("father被移出了");
                  });

                  $(".father").hover(function () {
                    console.log("father被移入移出了");
                  
                  });
            });
        </script>
    </head>
    <body>
        <div class="father">
            <div class="son">

            </div>
        </div>
    </body>
</html>